﻿using System.Data;
using Navigant.Infrastructure.Cases;
using Navigant.Infrastructure.EntityFactoryFramework;
using Navigant.Infrastructure.Helpers;
using Navigant.Model.Custodians;

namespace Navigant.UnitTests.MockCustodianSqlRepository
{
    public class MockCustodianFactory : IEntityFactory<Custodian>
    {
        #region Field Names

        internal static class FieldNames
        {
            public const string Id = "CustodianID";
            public const string Name = "Name";
            public const string Email = "Email";
            public const string Status = "PreservationNoticeStatus";
        }

        #endregion

        #region IEntityFactory<Custodian> Members

        public Custodian BuildEntity(IDataReader reader, ICase parentCase)
        {
            Custodian custodian = new Custodian(parentCase,
                new CustodianName(DataHelper.GetString(reader[FieldNames.Name])),
                DataHelper.GetString(reader[FieldNames.Email]),
                DataHelper.GetInteger(reader[FieldNames.Id]));

            return custodian;
        }

        public void LoadExtendedProperties(IDataReader reader, Custodian entity)
        {
        }

        #endregion
    }
}
